package cn.aishua.ui.test;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import cn.aishua.location.Locator;
import cn.aishua.location.Locator.Callback;
import cn.aishua.util.NetworkState;

import cn.aishua.R;
import com.baidu.location.BDLocation;

public class LocationTestActivity extends Activity{
	
	TextView tv;
	
	Button btn;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.location_test);
		
		tv = (TextView)findViewById(R.id.textView1);
		btn = (Button)findViewById(R.id.button1);
		
		NetworkState.is3gAvailable(this);
		
		btn.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				Locator l = Locator.getInstance(getApplicationContext());
				l.find(new Callback() {
					public void onFindFinished(BDLocation location) {
						tv.setText(location.toString());
					}
				});
				tv.setText("Searching ...");
			}
		});
	}
	
}


